package util

import (
	"math"
	"strconv"
	"time"
)

func HumanTime(old time.Time) string {
	var subTime = time.Now().Sub(old)
	var seconds = subTime.Seconds()
	var minuteStr = strconv.FormatFloat(math.Floor(seconds/60), 'f', 0, 64)
	var secondStr = strconv.Itoa((int(seconds)) % 60)

	var humanDate = ""
	if minuteStr != "0" {
		humanDate += minuteStr + "分"
	}
	return humanDate + secondStr + "秒"
}
